Skip to content

Slim down: cut dead features, close the core-loop hole, reconcile schema, harden AI parsing - #5

Merged
Ben-K-Jordan merged 3 commits into
mainfrom
claude/session-link-generation-SCkSf
Jul 16, 2026
Merged

Slim down: cut dead features, close the core-loop hole, reconcile schema, harden AI parsing#5
Ben-K-Jordan merged 3 commits into
mainfrom
claude/session-link-generation-SCkSf

Conversation

@Ben-K-Jordan

Copy link
Copy Markdown
Owner

Full slim-down pass from the audit: remove everything that looked like a feature but could not deliver, fix the holes that made the core loop unreachable or fragile, and make setup honest and repeatable.

Cut (about 3,600 lines and 46 npm packages)

  • Push notifications and the service worker (no HTTPS, no VAPID keys, never fired)
  • Email reminder scheduler (no SMTP configured, silently dropped everything)
  • Leaderboard (single-user app competing against nobody)
  • Practice sets and evidence API routes (unreachable from any page)
  • Asset pipeline scripts, start.bat, OFFICE_HOURS_PREP session mode

Fixed

  • Core-loop hole: the Learn page recommendation now actually starts a session. It was a dead link to the plan page that ignored its query params, meaning single sessions were impossible to start outside 7-day plan creation.
  • Session completion now awards XP (was silently skipped), with a dedupe guard.
  • Calibration screen restores after a page refresh at the end screen.
  • Plan page gained the reschedule-missed-sessions button the reflow API always supported.
  • JSONB reads are guarded at transaction sites so a malformed row cannot crash a run.

Auth gates flagged off

  • Email verification only blocks sign-in when REQUIRE_EMAIL_VERIFICATION=true (it once locked the owner out of a local production build).
  • X-User-Id header trust now only under ALLOW_TEST_AUTH=true, with a loud startup warning.

Schema reconciliation

  • Dropped the four dead tables, plus a drift-fix migration: six foreign keys created RESTRICT but declared Cascade, a stray default on session_error_logs.user_id, four never-migrated indexes, and a flashcards (deck_id, ordinal) unique index with an ordinal dedupe pass.
  • CI now runs prisma migrate deploy instead of db push --force-reset, so the migration history itself is what gets tested. Validated from zero and against data-bearing databases.

AI output hardening

  • Feedback, prompt generation, and worked examples validate provider output field by field; malformed output degrades to deterministic fallbacks instead of persisting garbage or crashing.
  • The mock provider returns realistic canned prompts, feedback, and worked examples so mock mode exercises the real parsing paths.
  • Plan creation pre-builds objective anchors so feedback retrieval is warm before the first session.

Setup and docs

  • setup.mjs checks Node >= 20.19 and states plainly when you are in mock AI mode.
  • Settings page drops dead toggles; Google sync shows a not-configured note instead of a dead button.
  • README documents prerequisites, what mock mode does and does not do, and deployment/ops notes.

Verification

  • tsc --noEmit clean
  • 621 unit tests passed (20 new)
  • 126 integration tests passed (4 removed with the practice-set tables)
  • Full e2e: 57 passed, 15 skipped (exact baseline)

Generated by Claude Code

claude added 3 commits July 16, 2026 21:10
…d auth gates

Core-loop fixes:
- The Learn page's Start Session recommendation now actually creates a
  session and opens it (the core loop was previously reachable only through
  full 7-day plan creation); objective ids reuse mastery keys so spaced
  repetition stays continuous
- Worked examples get a plan-template block on day 1 (first exposure)
- Completing a session finally awards XP (previously only flashcard reviews
  moved the daily goal, nudging toward card grinding over retrieval)
- The calibration dashboard survives page reloads (refetches the completed
  run's attempts)
- Reschedule missed sessions button on the plan page (preview diff + apply),
  giving ~900 lines of tested reflow logic its missing UI
- JSONB metric reads spread defaults so malformed rows can't produce NaNs

Cuts (verified dead or placebo):
- Web push stack (nothing ever sent one), service worker, VAPID setup burden
- Email reminder pipeline (nothing scheduled AND nothing processed; settings
  advertised reminders that never sent an email) — auth emails kept
- Leaderboard of one user plus the onboarding display-name step that existed
  only to name yourself for it
- Practice-sets and evidence CRUD routes (curl-only, data never consumed)
- start.bat (killed every Node process on the machine)
- OFFICE_HOURS_PREP mode (declared everywhere, implemented nowhere)
- Dead asset pipeline (Button/Icon had zero importers) and 46 packages
  (web-push, sharp, svgo, fast-glob); dotenv declared explicitly

Auth gates (the family behind every past lockout):
- Email verification sign-in gate now behind REQUIRE_EMAIL_VERIFICATION,
  default off (single user; the console provider cannot deliver links)
- X-User-Id header trust only under ALLOW_TEST_AUTH (dev sessions can no
  longer silently split data across phantom localStorage identities)
- Clients no longer send identity headers anywhere; cookies carry auth;
  e2e specs authenticate via Playwright context headers instead
- Onboarding copy now points at the Plan page where upload actually lives

Verified: tsc clean; 598 unit tests passing.
Settings drops the leaderboard toggle, display name field, and the entire
notifications section (push/email are gone from the product). Google sync
shows a not-configured note instead of a dead button when GOOGLE_CLIENT_ID
is unset. Flashcards and guides empty states route to /plan. Verify-email
explains dev mode prints links to the server console; the console email
provider prints full untruncated URLs. setup.mjs checks Node >= 20.19 and
reminds about mock AI mode at the end. .env.example loses VAPID keys and
documents REQUIRE_EMAIL_VERIFICATION (default off).
Schema: removes PushSubscription, ScheduledReminder, PracticeSet, and
PracticeQuestion models now that their features are gone. Migration
20260716030000_slim_and_reconcile drops the four tables and fixes drift
that made migrate deploy diverge from the schema: six foreign keys
created RESTRICT but declared Cascade, a stray DEFAULT '' on
session_error_logs.user_id, four indexes that were never migrated, and
a flashcards (deck_id, ordinal) unique index with a ROW_NUMBER dedupe
pass first. CI now runs prisma migrate deploy instead of db push
--force-reset so the migration history is what gets tested.

AI hardening: feedback, prompt generation, and worked examples now
validate provider output field by field. Malformed strings are dropped
instead of persisted, prompt sets with fewer than three valid items
fall back to deterministic generation, and worked example sets require
complete steps and completion problems. The mock provider returns
realistic canned prompts, feedback, and worked examples so mock mode
exercises real parsing, with malformed variants available for tests.

Plans now fire an anchor build after creation so feedback has warm
objective anchors before the first session; failures fall back to FTS.
Account export and delete no longer reference the dropped tables.
@Ben-K-Jordan
Ben-K-Jordan merged commit 401a1a2 into main Jul 16, 2026
0 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants